<?php
require '../database/intro.php';
$intro=new intro();
?>
<?php 
    
    $id=$_GET['id'];
    $data=$intro->showOne($id);
    $error="";
    if(isset($_POST['ok'])){
        if($_POST['value']==""){
            $error="Khong duoc bo trong phan nay";
        }  else {
            $value=$_POST['value'];
            if($intro->update($id,$value)){
                echo 'cap nhat thanh cong';
            }  else {
                echo 'That bai';
            }
        }
        
    }
?>
<script src="libraries/ckeditor/ckeditor.js"></script>
<h1>Them thong tin mo ta</h1>
<form method="post" action="">
<table>
    <tr>
        <td>Noi dung:</td>
    <td>
        <textarea cols="48" rows="6" class="ckeditor" name="value"><?php echo $data['intro_value']; ?></textarea><span style="color: red">* <?php echo$error;?></span>	
    </td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td><input type="submit" name="ok" value="cap nhat"/></td>
    </tr>
</table>
</form>